package com.zyz.friend.controller.question;

import com.zyz.common.core.model.Result;
import com.zyz.common.core.model.TableDataInfo;
import com.zyz.friend.model.question.dto.QuestionQueryDTO;
import com.zyz.friend.model.question.vo.QuestionDetailVO;
import com.zyz.friend.service.quesiton.IQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/question")
public class QuestionController {

    @Autowired
    private IQuestionService questionService;

    @RequestMapping(value = "/semiLogin/list",method = RequestMethod.GET)
    public TableDataInfo list (QuestionQueryDTO questionQueryDTO){
        return questionService.list(questionQueryDTO);
    }

    @RequestMapping(value = "/detail",method = RequestMethod.GET)
    public Result<QuestionDetailVO> detail (Long questionId) {
        return Result.ok(questionService.detail(questionId));
    }

    @RequestMapping(value = "/preQuestion",method = RequestMethod.GET)
    public Result<String> preQuestion(Long questionId) {
        return Result.ok(questionService.preQuestion(questionId));
    }

    @RequestMapping(value = "/nextQuestion",method = RequestMethod.GET)
    public Result<String> nextQuestion(Long questionId) {
        return Result.ok(questionService.nextQuestion(questionId));
    }

    @RequestMapping(value = "/semiLogin/hotList",method = RequestMethod.GET)
    public Result<List<String>> getQuestionHotList(Long size) {
        List<String> questionHotList = questionService.getQuestionHotList(size);
        return Result.ok(questionHotList);
    }
}
